package com.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.util.JdbcUtil;
@WebServlet("/WorkstationUpdate")
public class WorkstationUpdate extends HttpServlet{
	@Override
	protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		Integer wid =Integer.parseInt(request.getParameter("wid"));
		String wname = request.getParameter("wname");
		String waddress = request.getParameter("waddress");
		String wdesc = request.getParameter("wdesc");
		String sql = "update workstation set wid=?, wname=?,waddress=?,wdesc=? where wid="+wid;
		JdbcUtil jdbc = new JdbcUtil();
		try {
			jdbc.updatePreparedStatement(sql,wid,wname,waddress,wdesc);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		PrintWriter out = response.getWriter();
		out.print(1);
		out.flush();
		out.close();
	}
}

